<?php
/**
 * 管理员
 *
 * @copyright  Copyright (c) 2015-2025 NcPHP Inc. (http://www.ncphp.com)
 * @license    http://www.ncphp.com
 * @link       http://www.ncphp.com
 * @author	   NcPHP Team
 * @since      File available since Release v1.1
 */
defined('InNcPHP') or exit('Access Invalid!');

class adminModel extends Model{

	public function __construct(){
		parent::__construct('admin');
	}

	// 列表
	public function getAdminList($condition = array(), $field = '*', $page = 0, $order = 'admin_id desc'){
		return $this->field($field)->where($condition)->page($page)->order($order)->select();
	}

	// 信息
	public function getAdminInfo($condition = array(), $field = '*'){
		return $this->field($field)->where($condition)->find();
	}

	// 添加
	public function addAdmin($param){
		return $this->insert($param);
	}

	// 更新
	public function updateAdmin($condition, $param){
		return $this->where($condition)->update($param);
	}

	// 删除
	public function delAdmin($condition){
		return $this->where($condition)->delete();
	}

	// 联合权限组搜索列表
	public function getAdminJoinGroupList($condition = array(), $field = '*', $page = 0, $order = 'admin_id desc'){
		return $this->table('admin,admin_group')->field($field)->join('left join')->on('admin.group_id = admin_group.group_id')->where($condition)->page($page)->order($order)->select();
	}
}
?>